package top.eggcode.system.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.eggcode.common.mvc.Result;
import top.eggcode.system.client.factory.UserClientFactory;
import top.eggcode.system.client.model.Account;
import top.eggcode.system.client.model.User;

import java.util.Set;

@FeignClient(name = "sense-system", contextId = "userClientService", fallback = UserClientFactory.class)
public interface UserClientService {

    @PostMapping(value = "/api/user/findByName", headers = "source=inner")
    Result<User> findByName(@RequestParam("username") String username);

    @PostMapping(value = "/api/user/power_code_list", headers = "source=inner")
    Result<Set<String>> getPowerCodeList(@RequestParam("username") String username);

    @PostMapping(value = "/api/user/role_code_list", headers = "source=inner")
    Result<Set<String>> getRoleCodeList(@RequestParam("username") String username);

    @PostMapping(value = "/api/account/findByName", headers = "source=inner")
    Result<Account> findAccount(@RequestParam("username") String username);
}
